package com.quanshu.shop.main.api;

import com.quanshu.exchange.support.net.BaseResponse;
import com.quanshu.shop.goods.entity.AddGoodsLikeEntity;
import com.quanshu.shop.goods.entity.GoodsInfoEntity;
import com.quanshu.shop.goods.entity.GoodsListEntity;
import com.quanshu.shop.goods.entity.MyCartEntity;
import com.quanshu.shop.goods.entity.SearchListEntity;
import com.quanshu.shop.goods.entity.SkuEntity;
import com.quanshu.shop.goods.entity.SpecialGoodsInfo;
import com.quanshu.shop.main.entity.ShopMainEntity;
import com.quanshu.shop.order.entity.CreatOrderEntity;
import com.quanshu.shop.order.entity.MyBalanceEntity;
import com.quanshu.shop.order.entity.OrderDetailsEntity;
import com.quanshu.shop.order.entity.SubmitPrepareEntity;
import com.quanshu.shop.person.entity.AddressBaseEntity;
import com.quanshu.shop.person.entity.AdressResultEntity;
import com.quanshu.shop.person.entity.MylikeEntity;
import com.quanshu.shop.sort.entity.SortTypeEntity;

import java.util.List;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

/**
 * 作者  李哲
 * 创建时间 2018/7/17
 * 邮箱 lizhetongliao@163.com
 * 说明
 **/
public interface ShopMainIF {
    /**
     * 店铺首页
     *
     * @param key
     * @return
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_index&action=homePage")
    Observable<BaseResponse<ShopMainEntity>> getShopInfo(@Field("key") String key);

    /**
     * 分类
     *
     * @param key
     * @return
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_goods&action=goodsTypeList")
    Observable<BaseResponse<List<SortTypeEntity.DataEntity>>> getSortTypeInfo(@Field("key") String key);

    /**
     * 商品列表
     *
     * @param categoryId
     * @return
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_goods&action=goodsList")
    Observable<BaseResponse<List<GoodsListEntity.DataEntity>>> getGoodsListInfo(@Field("category_id") String categoryId, @Field("type") String type, @Field("sort") String sort);

    /**
     * 搜索商品列表
     *
     * @param categoryId
     * @return
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_goods&action=goodsSearch")
    Observable<BaseResponse<List<SearchListEntity>>> getSearchGoodsListInfo(@Field("where") String categoryId);

    /**
     * 商品详情
     *
     * @param goodsId
     * @return
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_goods&action=goodsDetails")
    Observable<BaseResponse<GoodsInfoEntity.DataEntity>> getGoodsInfo(@Field("goods_id") String goodsId, @Field("user_id") String userId);

    /**
     * 添加收藏商品​
     *
     * @param goodsId
     * @return
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_goods&action=goodsCollect")
    Observable<BaseResponse<AddGoodsLikeEntity.DataEntity>> addLikeGoodsInfo(@Field("apikey") String apiKey, @Field("category_id") String categoryId, @Field("goods_id") String goodsId, @Field("user_id") String userId);

    /**
     * 取消收藏商品​
     *
     * @param /index.php?model=api&controller=api_ucenter&action=getFavoList
     * @return
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_ucenter&action=delFavoById")
    Observable<BaseResponse<AddGoodsLikeEntity.DataEntity>> deleteLikeGoodsInfo(@Field("apikey") String apiKey, @Field("favo_id") String categoryId, @Field("user_id") String userId);

    /**
     * 获取收藏列表​
     *
     * @param /
     * @return
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_ucenter&action=getFavoList")
    Observable<BaseResponse<List<MylikeEntity.DataEntity>>> getLikeGoodsInfo(@Field("apikey") String apiKey, @Field("user_id") String userId);

    /**
     * 获取购物车列表​
     *
     * @param /
     * @return
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_ucenter&action=getMyCart")
    Observable<BaseResponse<MyCartEntity>> getCartListInfo(@Field("apikey") String apiKey, @Field("user_id") String userId);

    /**
     * 获取购物车列表​
     *
     * @param /
     * @return
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_goods&action=getProduct")
    Observable<BaseResponse<SkuEntity>> getSkuInfo(@Field("goods_id") String goodsId, @Field("specJSON") String specId);

    /**
     * 添加到购物车
     *
     * @param /
     * @return
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_cart&action=joinCart")
    Observable<BaseResponse<String>> addGoodsToCartInfo(@Field("apikey") String apiKey,
                                                        @Field("goods_id") String goodId,
                                                        @Field("goods_num") String goodsNumber,
                                                        @Field("is_inn") String isInn,
                                                        @Field("is_pay") String idPay,
                                                        @Field("user_id") String userId,
                                                        @Field("type") String type);

    /**
     * 更改购物车商品数量
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_ucenter&action=increOrReduCart")
    Observable<BaseResponse<String>> alterCartGoodsNumberInfo(@Field("apikey") String apiKey,
                                                              @Field("user_id") String userId,
                                                              @Field("goods_id") String goodId,
                                                              @Field("goods_num") String goodsNumber,
                                                              @Field("goods_type") String type);

    /**
     * 删除购物车商品
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_ucenter&action=removeCart")
    Observable<BaseResponse<String>> deleteCartGoods(@Field("apikey") String apiKey,
                                                     @Field("user_id") String userId,
                                                     @Field("goodsArr") String goodsArr);

    /**
     * 获取预订单
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_order&action=confirmOrder")
    Observable<BaseResponse<SubmitPrepareEntity>> getPrepareOrder(@Field("user_id") String userId,
                                                                  @Field("goodsArr") String goodsArr,
                                                                  @Field("memberid") String menberID,
                                                                  @Field("address_id") String addressId,
                                                                  @Field("is_type") String istype);

    /**
     * 获取省
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_ucenter&action=getTopArea")
    Observable<BaseResponse<List<AddressBaseEntity.DataEntity>>> getProvince(@Field("apikey") String apikey);

    /**
     * 获取市区
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_ucenter&action=getAreaByAreaId")
    Observable<BaseResponse<List<AddressBaseEntity.DataEntity>>> getCity(@Field("area_id") String areaId);

    /**
     * 新增或修改地址​/
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_ucenter&action=insertOrEditAddr")
    Observable<BaseResponse<AdressResultEntity>> addAddress(@Field("apikey") String apiKey,
                                                            @Field("user_id") String userId,
                                                            @Field("addr_id") String addrId,
                                                            @Field("accept_name") String acceptName,
                                                            @Field("mobile") String phone,
                                                            @Field("province") String provinceId,
                                                            @Field("city") String cityId,
                                                            @Field("area") String areaId,
                                                            @Field("address") String addressInfo,
                                                            @Field("is_default") String isDefault);

    /**
     * 获取用户地址
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_ucenter&action=addressList")
    Observable<BaseResponse<List<SubmitPrepareEntity.AddressListEntity>>> getUserAddress(@Field("apikey") String apiKey,
                                                                                         @Field("user_id") String userId);

    /**
     * 删除收货地址​
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_ucenter&action=delAddrByAddrId")
    Observable<BaseResponse<String>> deleteUserAddress(@Field("apikey") String apiKey,
                                                       @Field("user_id") String userI,
                                                       @Field("addr_id") String addrId);

    /**
     * 获取账户余额​
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_ucenter&action=getUser")
    Observable<BaseResponse<MyBalanceEntity>> getMyBalance(@Field("user_id") String apiKey);

    /**
     * 创建订单​
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_order&action=createOrder")
    Observable<BaseResponse<CreatOrderEntity>> createOrder(@Field("user_id") String userId,
                                                           @Field("goodsArr") String goodsArr,
                                                           @Field("memberid") String menberID,
                                                           @Field("address_id") String addressId,
                                                           @Field("order_id") String oderID,
                                                           @Field("remark") String remark);

    /**
     * 获取账户余额​
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_pay&action=niuScorePay")
    Observable<BaseResponse<String>> doNjfPay(@Field("user_id") String userId, @Field("order_number") String OrderNumber, @Field("niuScore") String NjfNumber, @Field("password") String payPassword, @Field("memberid") String memberid​);

    /**
     * 获取搜索页的大家都在搜数据
     *
     * @param key
     * @return
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_goods&action=hotSearch")
    Observable<BaseResponse<List<String>>> getSearchTxtInfo(@Field("key") String key);


    /**
     * 订单详情
     *
     * @param order_id
     * @return
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_ucenter&action=orderDetail")
    Observable<BaseResponse<OrderDetailsEntity>> getOrderDetail(@Field("apikey") String apiKey,
                                                                @Field("order_id") String order_id);

    /**
     * 获取特殊商品信息
     */
    @FormUrlEncoded
    @POST("index.php?model=api&controller=api_goods&action=getHot")
    Observable<BaseResponse<SpecialGoodsInfo>> getSpecialInfo(@Field("id") String specialId);
}
